<?php

declare(strict_types=1);

namespace App\Controller\Chat;


use App\Controller\BaseController;
use App\Request\Chat\LockMiRequest;
use App\Request\Chat\VoiceMiRequest;
use App\Services\Chat\MicroPhoneService;
use Hyperf\Context\Context;
use Hyperf\Di\Annotation\Inject;

class MicroPhoneController extends BaseController
{

    #[Inject]
    protected MicroPhoneService $service;


    /**
     * Note - 锁定\解锁麦克风
     * DateTime 2024/9/3 19:27
     * User Admin
     * @param LockMiRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function lock(LockMiRequest $request)
    {
        $params = $this->request->post();
        $request->execute($params);
        // $userInfo = Context::get('user');
        $this->service->lock($params);
        return $this->return();
    }

    /**
     * Note - 禁用\开启麦克风语音声音
     * DateTime 2024/9/3 19:27
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function voice(VoiceMiRequest $request)
    {
        $params = $this->request->post();
        $request->execute($params);
        // $userInfo = Context::get('user');
        $this->service->voice($params);
        return $this->return();

    }

}
